<template>
	<div id="app">
		<!-- <div class="banners" >


			
			<div class="heads " style="margin:  0 0 5%;">
			
				<div class="" style="">
					<img :src="info.huodong.picurl" alt="">

				</div>
			</div>
		</div> -->
	
		
		
		<div class="huodong new">
			<div class="a1" style="text-align: center;padding-top: 1px;position: relative;">
				<img src="/static/image/a2.png" alt="" style="width: 50%;margin: -3px auto 0;">
				<div style="position: absolute;top: 0;width: 100%;text-align: center;color: #ffffff;">活动详情</div>
			</div>
			<div class="a2" style="min-height: 400px;">
				<div v-html="content" style="padding: 10px 5px 20px;"></div>
			</div>

		</div>
    <div class="gerenfx" @click="tiaos()">
      <img src="/static/image/share.png" alt="">
    </div>
		 <div style="height: 80px;"></div>
	</div>
</template>
import 'vant/lib/index.less';
<style>
	@notice-bar-text-color: #000000;
</style>
<script>
	import Vue from 'vue';
	import {
		NoticeBar
	} from 'vant';
	import {
		Search
	} from 'vant';
	import {
		Toast
	} from 'vant';
	import {
		CountDown
	} from 'vant';
	import wx from 'weixin-js-sdk';
	Vue.use(CountDown);
	Vue.use(Search);
	Vue.use(NoticeBar);


	Vue.use(Toast);
	export default {
		data() {
			return {
				info: [],
				images: [],
				tjlist: [],
				list: [],
				gonggao: '',
				value: '',
				immediate: false,
				loading: false,
				finished: false,
				page: 1, //请求第几页
				total: 0, //总共的数据条数
				description: '',
				time: 10 * 60 * 60 * 1000,
				timeData: {},
				content:'',

			}
		},
		components: {},
		created: function() {
			this.$emit('footer', true);
		},


		mounted() {
			//this.getShareInfo();
			this.recordapi();
			// this.timer = setInterval(() => {
			//    location.href=location
			// },60000)
		},
		// beforeDestroy(){
		//   clearInterval(this.timer);        
		//   this.timer = null;
		// },
		activated() {
			if (this.$route.meta.keepAlive) {
				this.$emit('footer', true);
			}
		},
		metaInfo() {
			const title = '活动详情'
			return {
				title,
				meta: [{
						description:  this.info.description
					},
			 	{
						keywords:  this.info.keyword
					},
				]
			}
		},
		methods: {
      tiaos(e) {
      this.$router.push('Shares')
      console.log(e)
      },
			getShareInfo() {
			      
			         // 只需要传地址就好，其他后端都会写好来
					let url=location.href.split('#')[0]
					let wPath = window.document.location.href;
					 let pathName =  window.document.location.pathname;
					  let pos = wPath.indexOf(pathName);
					  
					  // 获取主机地址，如：http://localhost:8080
					  let localhostPath = wPath.substring(0, pos);
					  console.log(url);
					var that = this;
					that.$api.post("/Index/jssdk", {url:url }).then(res => {
			        const config = res.data;
					const huodong = res.huodong;
			        wx.config({
			          appId: config.appId,  // appID 公众号的唯一标识
			          timestamp: config.timestamp, // 生成签名的时间戳
			          nonceStr: config.nonceStr, //  生成签名的随机串
			          signature: config.signature, // 生成的签名
			          jsApiList: [
			            'updateAppMessageShareData',
			            'updateTimelineShareData',
			          ]
			        });
			        wx.ready(() => {
			          var shareData = {
			            title: huodong.title,
			            desc: huodong.introduction,
			            link: localhostPath,
			            imgUrl:
			               huodong.picurl,
			          };
			          //点击要去分享
			          wx.updateAppMessageShareData(shareData);
			          wx.updateTimelineShareData(shareData);
			         
			        });
			      });
			    },
			change(e) {
				console.log(e);
				let timer = e;
				if (timer.hours < 10) {
					timer.hours = '0' + timer.hours
				}
				if (timer.minutes < 10) {
					timer.minutes = '0' + timer.minutes
				}
				if (timer.seconds < 10) {
			 	timer.seconds = '0' + timer.seconds
				}

				this.timeData = timer;

			},
			tiao(e) {
				this.$router.push('Usercont?id=' + e)
				console.log(e);
			},
			urllinks(e) {
				this.$router.push(e)
				console.log(e);
			},
			onSearch(e) {

			},

			recordapi() {
				var that = this;
				that.$api.post("/Index/huodong", {}).then(res => {
					that.info = res.info;
					that.content= res.info.huodong.content;
				});
			},
			// 加载
			onJiazai: function() {
				var that = this;
				that.recordapi()
			},
		}
	}
</script>
<style scoped>
.huodong.new{
  overflow: hidden;
  background-color: #262426;
}
.huodong .a2{
  color: #fff;
}
.gerenfx {
  position: fixed;
  bottom: 120px;
  right: 20px;
}

.gerenfx img {
  width: 40px;
  height: 40px;
}
  
</style>